<?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:62:"G:\www\tpshop\public/../application/admin\view\goods\edit.html";i:1544168679;s:52:"G:\www\tpshop\application\admin\view\common\top.html";i:1536748058;s:53:"G:\www\tpshop\application\admin\view\common\left.html";i:1542876238;}*/ ?>
<!DOCTYPE html>
<html><head>
        <meta charset="utf-8">
    <title>童老师ThinkPHP交流群：484519446</title>

    <meta name="description" content="Dashboard">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!--Basic Styles-->
    <link href="/static/admin/style/bootstrap.css" rel="stylesheet">
    <link href="/static/admin/style/font-awesome.css" rel="stylesheet">
    <link href="/static/admin/style/weather-icons.css" rel="stylesheet">

    <!--Beyond styles-->
    <link id="beyond-link" href="/static/admin/style/beyond.css" rel="stylesheet" type="text/css">
    <link href="/static/admin/style/demo.css" rel="stylesheet">
    <link href="/static/admin/style/typicons.css" rel="stylesheet">
    <link href="/static/admin/style/animate.css" rel="stylesheet">
    <script src="/static/plus/ueditor/ueditor.config.js"></script>
    <script src="/static/plus/ueditor/ueditor.all.min.js"></script>
    <script src="/static/plus/ueditor/lang/zh-cn/zh-cn.js"></script>

    <style>
        .price{
            width:150px;
            margin-left:10px;
            display:inline-block;
        }
    </style>
    
</head>
<body>
    <!-- 头部 -->
    	<div class="navbar">
    <div class="navbar-inner">
        <div class="navbar-container">
            <!-- Navbar Barnd -->
            <div class="navbar-header pull-left">
                <a href="#" class="navbar-brand">
                    <small>
                            <img src="/static/admin/images/logo.png" alt="">
                        </small>
                </a>
            </div>
            <!-- /Navbar Barnd -->
            <!-- Sidebar Collapse -->
            <div class="sidebar-collapse" id="sidebar-collapse">
                <i class="collapse-icon fa fa-bars"></i>
            </div>
            <!-- /Sidebar Collapse -->
            <!-- Account Area and Settings -->
            <div class="navbar-header pull-right">
                <div class="navbar-account">
                    <ul class="account-area">
                        <li>
                            <a class="login-area dropdown-toggle" data-toggle="dropdown">
                                <div class="avatar" title="View your public profile">
                                    <img src="/static/admin/images/adam-jansen.jpg">
                                </div>
                                <section>
                                    <h2><span class="profile"><span>admin</span></span></h2>
                                </section>
                            </a>
                            <!--Login Area Dropdown-->
                            <ul class="pull-right dropdown-menu dropdown-arrow dropdown-login-area">
                                <li class="username"><a>David Stevenson</a></li>
                                <li class="dropdown-footer">
                                    <a href="/admin/user/logout.html">
                                            退出登录
                                        </a>
                                </li>
                                <li class="dropdown-footer">
                                    <a href="/admin/user/changePwd.html">
                                            修改密码
                                        </a>
                                </li>
                            </ul>
                            <!--/Login Area Dropdown-->
                        </li>
                        <!-- /Account Area -->
                        <!--Note: notice that setting div must start right after account area list.
                            no space must be between these elements-->
                        <!-- Settings -->
                    </ul>
                </div>
            </div>
            <!-- /Account Area and Settings -->
        </div>
    </div>
</div>
    <!-- /头部 -->
    
    <div class="main-container container-fluid">
        <div class="page-container">
            <!-- Page Sidebar -->
            <div class="page-sidebar" id="sidebar">
    <!-- Page Sidebar Header-->
    <div class="sidebar-header-wrapper">
        <input class="searchinput" type="text">
        <i class="searchicon fa fa-search"></i>
        <div class="searchhelper">Search Reports, Charts, Emails or Notifications</div>
    </div>
    <!-- /Page Sidebar Header -->
    <!-- Sidebar Menu -->
    <ul class="nav sidebar-menu">
        <!--Dashboard-->
        <li>
            <a href="#" class="menu-dropdown">
                <i class="menu-icon fa fa-shopping-cart"></i>
                <span class="menu-text">
                    商品管理
                </span>
                <i class="menu-expand"></i>
            </a>
            <ul class="submenu">
                <li>
                    <a href="<?php echo url('admin/Goods/index'); ?>">
                        <span class="menu-text">
                            商品列表
                        </span>
                        <i class="menu-expand"></i>
                    </a>
                </li>
                <li>
                    <a href="<?php echo url('admin/Goods/add'); ?>">
                        <span class="menu-text">
                            添加商品
                        </span>
                        <i class="menu-expand"></i>
                    </a>
                </li>
                <li>
                    <a href="<?php echo url('admin/Brand/index'); ?>">
                        <span class="menu-text">
                            商品品牌
                        </span>
                        <i class="menu-expand"></i>
                    </a>
                </li>
                <li>
                    <a href="<?php echo url('admin/Category/index'); ?>">
                        <span class="menu-text">
                            商品分类
                        </span>
                        <i class="menu-expand"></i>
                    </a>
                </li>
                <li>
                    <a href="<?php echo url('admin/Type/index'); ?>">
                        <span class="menu-text">
                            商品类型
                        </span>
                        <i class="menu-expand"></i>
                    </a>
                </li>
                <li>
                    <a href="/admin/user/index.html">
                        <span class="menu-text">
                            商品回收站
                        </span>
                        <i class="menu-expand"></i>
                    </a>
                </li>
            </ul>
        </li>

        <li>
            <a href="#" class="menu-dropdown">
                <i class="menu-icon fa fa-windows"></i>

                <span class="menu-text">
                    推荐位管理
                </span>
                <i class="menu-expand"></i>
            </a>
        </li>

        <li>
            <a href="#" class="menu-dropdown">
                <i class="menu-icon fa fa-list-ul"></i>

                <span class="menu-text">
                    文章模块
                </span>
                <i class="menu-expand"></i>
            </a>
            <ul class="submenu">
                <li>
                    <a href="<?php echo url('admin/Cate/index'); ?>">
                        <span class="menu-text">
                            文章分类
                        </span>
                        <i class="menu-expand"></i>
                    </a>
                </li>
                <li>
                    <a href="<?php echo url('admin/Article/index'); ?>">
                        <span class="menu-text">
                            文章管理
                        </span>
                        <i class="menu-expand"></i>
                    </a>
                </li>
            </ul>                            
        </li>

        <li>
            <a href="#" class="menu-dropdown">
                <i class="menu-icon fa fa-link"></i>

                <span class="menu-text">
                    友情链接
                </span>
                <i class="menu-expand"></i>
            </a>
            <ul class="submenu">
                <li>
                    <a href="<?php echo url('admin/Link/index'); ?>">
                        <span class="menu-text">
                            链接列表
                        </span>
                        <i class="menu-expand"></i>
                    </a>
                </li>
            </ul>                            
        </li>

        <li>
            <a href="#" class="menu-dropdown">
                <i class="menu-icon fa fa-users"></i>

                <span class="menu-text">
                    会员管理
                </span>
                <i class="menu-expand"></i>
            </a>
            <ul class="submenu">
                <li>
                    <a href="<?php echo url('admin/Member/index'); ?>">
                        <span class="menu-text">
                            会员列表
                        </span>
                        <i class="menu-expand"></i>
                    </a>
                </li>
                <li>
                    <a href="<?php echo url('admin/Member/add'); ?>">
                        <span class="menu-text">
                            添加会员级别
                        </span>
                        <i class="menu-expand"></i>
                    </a>
                </li>
            </ul>                            
        </li>

        <li>
            <a href="#" class="menu-dropdown">
                <i class="menu-icon fa fa-picture-o"></i>

                <span class="menu-text">
                    图片管理
                </span>
                <i class="menu-expand"></i>
            </a>
            <ul class="submenu">
                <li>
                    <a href="<?php echo url('admin/Article/imglist'); ?>">
                        <span class="menu-text">
                            图片列表
                        </span>
                        <i class="menu-expand"></i>
                    </a>
                </li>
            </ul>                            
        </li>

        <li>
            <a href="#" class="menu-dropdown">
                <i class="menu-icon fa fa-gear"></i>

                <span class="menu-text">
                    系统设置
                </span>
                <i class="menu-expand"></i>
            </a>
            <ul class="submenu">
                <li>
                    <a href="<?php echo url('admin/Conf/conflist'); ?>">
                        <span class="menu-text">
                            配置项
                        </span>
                        <i class="menu-expand"></i>
                    </a>
                </li>
                <li>
                    <a href="<?php echo url('admin/Conf/index'); ?>">
                        <span class="menu-text">
                            配置管理
                        </span>
                        <i class="menu-expand"></i>
                    </a>
                </li>
                <li>
                    <a href="<?php echo url('admin/Article/imglist'); ?>">
                        <span class="menu-text">
                            支付方式设置
                        </span>
                        <i class="menu-expand"></i>
                    </a>
                </li>
            </ul>                            
        </li> 
        
    </ul>
    <!-- /Sidebar Menu -->
</div>
            <!-- /Page Sidebar -->
            <!-- Page Content -->
            <div class="page-content">
                <!-- Page Breadcrumb -->
                <div class="page-breadcrumbs">
                    <ul class="breadcrumb">
                        <li>
                            <a href="#">系统</a>
                        </li>
                        <li>
                            <a href="#">商品管理</a>
                        </li>
                        <li class="active">添加商品</li>
                    </ul>
                </div>
                <!-- /Page Breadcrumb -->

                <!-- Page Body -->
                <div class="page-body">
                    
    <div class="row">
        <div class="col-lg-12 col-sm-12 col-xs-12">
            <div class="widget">
                <form class="form-horizontal" role="form" action="" method="post" enctype="multipart/form-data">
                    <div class="widget-body">
                        <div class="widget-main ">
                            <div class="tabbable">
                                <ul class="nav nav-tabs tabs-flat" id="myTab11">
                                    <li class="active">
                                        <a data-toggle="tab" href="#home11">
                                            基本信息
                                        </a>
                                    </li>
                                    <li class="">
                                        <a data-toggle="tab" href="#profile11">
                                            描述信息
                                        </a>
                                    </li>
                                    <li class="">
                                        <a data-toggle="tab" href="#member_price">
                                            会员价格
                                        </a>
                                    </li>
                                    <li class="">
                                        <a data-toggle="tab" href="#goods_attr">
                                            商品属性
                                        </a>
                                    </li>
                                    <li class="">
                                        <a data-toggle="tab" href="#goods_photo">
                                            商品相册
                                        </a>
                                    </li>
                                </ul>
                                <div class="tab-content tabs-flat">
                                    <!-- 基本信息开始 -->
                                    <div id="home11" class="tab-pane active">
                                        <div class="form-group">
                                            <label for="group_id" class="col-sm-2 control-label no-padding-right">商品分类</label>
                                            <div class="col-sm-6">
                                                <select name="category_id" style="width: 100%;">
                                                    <option value="0">请选择商品分类</option>
                                                    <?php if(is_array($goodsCateRes) || $goodsCateRes instanceof \think\Collection || $goodsCateRes instanceof \think\Paginator): $i = 0; $__LIST__ = $goodsCateRes;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$goodsCate): $mod = ($i % 2 );++$i;?>
                                                    <option value="<?php echo $goodsCate['id']; ?>" <?php if($goods['category_id'] == $goodsCate['id']){ echo "selected='selected'";} ?> ><?php if($goodsCate['level'] != 0){ echo '|'; } echo str_repeat('-',$goodsCate['level']*5); ?><?php echo $goodsCate['cate_name']; ?></option>
                                                    <?php endforeach; endif; else: echo "" ;endif; ?>
                                                </select>
                                            </div>
                                        </div>

                                        <div class="form-group">
                                            <label for="group_id" class="col-sm-2 control-label no-padding-right">所属品牌</label>
                                            <div class="col-sm-6">
                                                <select name="brand_id" style="width: 100%;">
                                                    <option value="8">请选择品牌</option>
                                                    <?php if(is_array($brand) || $brand instanceof \think\Collection || $brand instanceof \think\Paginator): $i = 0; $__LIST__ = $brand;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$brand): $mod = ($i % 2 );++$i;?>
                                                    <option value="<?php echo $brand['id']; ?>" <?php if($goods['brand_id'] == $brand['id']){ echo "selected='selected'"; } ?> ><?php echo $brand['brand_name']; ?></option>
                                                    <?php endforeach; endif; else: echo "" ;endif; ?>
                                                </select>
                                            </div>
                                        </div>

                                        <div class="form-group">
                                            <label for="username" class="col-sm-2 control-label no-padding-right">商品名称</label>
                                            <div class="col-sm-6">
                                                <input class="form-control" placeholder="" name="goods_name" type="text" value="<?php echo $goods['goods_name']; ?>">
                                            </div>
                                            <p class="help-block col-sm-4 red">* 必填</p>
                                        </div>

                                        <div class="form-group">
                                            <label for="username" class="col-sm-2 control-label no-padding-right">商品主图</label>
                                            <div class="col-sm-6">
                                                <input placeholder="" name="og_thumb" type="file">
                                                <?php if($goods['mid_thumb'] != ''): ?>
                                                <img src="/static/upload/<?php echo $goods['mid_thumb']; ?>" alt="" style="margin-top:15px;">
                                                <?php else: ?>
                                                暂无图片
                                                <?php endif; ?>
                                            </div>
                                            
                                        </div>

                                        <div class="form-group">
                                            <label for="username" class="col-sm-2 control-label no-padding-right">市场价</label>
                                            <div class="col-sm-6">
                                                <div class="input-group">
                                                    <span class="input-group-addon">￥</span>
                                                    <input type="text" class="form-control" name="markte_price" value="<?php echo $goods['markte_price']; ?>">
                                                    <span class="input-group-addon">.00</span>
                                                </div>
                                            </div>
                                            <p class="help-block col-sm-4 red">* 必填</p>
                                        </div>

                                        <div class="form-group">
                                            <label for="username" class="col-sm-2 control-label no-padding-right">本店价</label>
                                            <div class="col-sm-6">
                                                <div class="input-group">
                                                    <span class="input-group-addon">￥</span>
                                                    <input type="text" class="form-control" name="shop_price" value='<?php echo $goods['shop_price']; ?>'>
                                                    <span class="input-group-addon">.00</span>
                                                </div>
                                            </div>
                                            <p class="help-block col-sm-4 red">* 必填</p>
                                        </div>

                                        <!-- <div class="form-group">
                                            <label for="username" class="col-sm-2 control-label no-padding-right">多选测试</label>
                                            <div class="col-sm-6">
                                                <div class="checkbox" style="float:left;margin-left:15px;">
                                                    <label>
                                                        <input type="checkbox" class="colored-blue" name="duoxuan[]" value="选项1" checked="checked">
                                                        <span class="text">选项1</span>
                                                    </label>
                                                </div>
                                            </div>
                                        </div> -->

                                        <div class="form-group">
                                            <label for="username" class="col-sm-2 control-label no-padding-right">是否上架</label>
                                            <div class="col-sm-6">
                                                <div class="radio" style="float:left; padding-right:10px;">
                                                    <label>
                                                        <input name="on_sale" value="1" class="colored-blue" type="radio" <?php if($goods['on_sale'] == 1){ echo 'checked="checked"' ;} ?> >
                                                        <span class="text">上架</span>
                                                    </label>
                                                </div>
                                                <div class="radio" style="float:left; padding-right:10px;">
                                                    <label>
                                                        <input name="on_sale" value="0" class="colored-blue" type="radio" <?php if($goods['on_sale'] == 0){ echo 'checked="checked"' ;} ?>>
                                                        <span class="text">下架</span>
                                                    </label>
                                                </div>
                                            </div>
                                            <p class="help-block col-sm-4 red">* 必填</p>
                                        </div>

                                        <div class="form-group">
                                            <label for="username" class="col-sm-2 control-label no-padding-right">重量单位</label>
                                            <div class="col-sm-6">
                                                <div class="input-group">
                                                    <input type="text" class="form-control" name="goods_weight" value="<?php echo $goods['goods_weight']; ?>" >
                                                    <div class="input-group-btn">
                                                        <select name="weight_unit">
                                                            <option value="1" <?php if($goods['weight_unit'] == 1){ echo 'selected="selected"';} ?> >kg</option>
                                                            <option value="2" <?php if($goods['weight_unit'] == 2){ echo 'selected="selected"';} ?>>&nbsp;&nbsp;g</option>
                                                        </select>
                                                    </div>
                                                    
                                                </div>
                                            </div>
                                        </div>

                                    </div>
                                    <!-- 基本信息结束 -->

                                    <!-- 描述信息开始 -->
                                    <div id="profile11" class="tab-pane">
                                        <div align="center">
                                            <textarea name="goods_des" id="content"><?php echo $goods['goods_des']; ?></textarea>
                                        </div>
                                    </div>
                                    <!-- 描述信息结束 -->

                                    <!-- 会员价格开始 -->
                                    <div id="member_price" class="tab-pane">
                                        <?php if(is_array($memberLevel) || $memberLevel instanceof \think\Collection || $memberLevel instanceof \think\Paginator): $i = 0; $__LIST__ = $memberLevel;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$item): $mod = ($i % 2 );++$i;?>
                                        <div class="form-group">
                                            <label for="username" class="col-sm-2 control-label no-padding-right"><?php echo $item['level_name']; ?></label>
                                            <div class="col-sm-6">
                                                <input class="form-control" placeholder="" name="member_price[<?php echo $item['id']; ?>]" type="text" value="<?php if(isset($mpRes[$item['id']]['mprice'])){ echo $mpRes[$item['id']]['mprice']; }else{echo '';} ?>" >
                                            </div>
                                            <p class="help-block col-sm-4 red">* 必填</p>
                                        </div>
                                        <?php endforeach; endif; else: echo "" ;endif; ?>
                                    </div>
                                    <!-- 会员价格结束 -->

                                    <!-- 商品属性开始 -->
                                    <div id="goods_attr" class="tab-pane">
                                        <div class="form-group">
                                            <label for="username" class="col-sm-2 control-label no-padding-right">商品类型</label>
                                            <div class="col-sm-6">
                                                <select name="type_id" class="form-control">
                                                    <option value="0">请选择：</option>
                                                    <?php if(is_array($goods_type) || $goods_type instanceof \think\Collection || $goods_type instanceof \think\Paginator): $i = 0; $__LIST__ = $goods_type;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$item): $mod = ($i % 2 );++$i;?>
                                                    <option value="<?php echo $item['id']; ?>"><?php echo $item['type_name']; ?></option>
                                                    <?php endforeach; endif; else: echo "" ;endif; ?>
                                                </select>
                                            </div>
                                        </div>
                                        <div id="attr_list">
                                            <!-- 商品属性显示 -->
                                        </div>
                                    </div>
                                    <!-- 商品属性结束 -->
                                    
                                    <!-- 商品相册开始 -->
                                    <div id="goods_photo" class="tab-pane">
                                        <div class="form-group">
                                            <label for="username" class="col-sm-2 control-label no-padding-right"></label>
                                            <div class="col-sm-6">
                                                <a href="javascript:" onclick="addrow(this)">[ + ]</a>
                                                <input placeholder="" class="form-control" name="goods_photo[]" type="file" style="border:none;box-shadow:none;display:inline-block;width:50%;margin-left:15px;">
                                            </div>
                                        </div>
                                    </div>
                                    <!-- 商品相册结束 -->
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-offset-2 col-sm-10">
                                    <button type="submit" class="btn btn-default">保存信息</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
    </div>
</div>

                </div>
                <!-- /Page Body -->
            </div>
            <!-- /Page Content -->
        </div>  
    </div>

        <!--Basic Scripts-->
    <script src="/static/admin/style/jquery_002.js"></script>
    <script src="/static/admin/style/bootstrap.js"></script>
    <script src="/static/admin/style/jquery.js"></script>
    <!--Beyond Scripts-->
    <script src="/static/admin/style/beyond.js"></script>
    <script>
        $("select[name=type_id]").change(function(){
            var type_id=$(this).val();
            $.post("<?php echo url('admin/Attr/ajaxGetAttr'); ?>",{type_id:type_id},function(data){
                var html = '';
                $.each($.parseJSON(data),function(k,v){
                   if(v.attr_type == 1){
                        html+="<div class='form-group'>";
                        html+="<label for='username' class='col-sm-2 control-label no-padding-right'>"+v.attr_name+"</label>";
                        var attrValuesArr = v.attr_values.split(',');
                        html+="<div class='col-sm-6'><a href='javascript:' onclick='addrow(this)' style='margin-right:10px;'>[ + ]</a>";
                        html+="<select name='goods_attr["+v.id+"][]'>";
                        html+="<option value=''>请选择：</option>";
                        for(i=0;i<attrValuesArr.length;i++){
                            html+="<option value='"+attrValuesArr[i]+"'>"+attrValuesArr[i]+"</option>";
                        }
                        html+="</select>";
                        html+="<input class='form-control price' placeholder='价格' name='attr_price[]' type='text'>";
                        html+="</div>";
                        html+="</div>";
                   }else{
                        if(v.attr_values){
                            alert("属性值存在")
                        }else{
                            html+="<div class='form-group'>";
                            html+="<label class='col-sm-2 control-label no-padding-right'>"+v.attr_name+"</label>";
                            html+="<div class='col-sm-6'>";
                            html+="<input class='form-control price' name=goods_attr["+v.id+"] type='text'>";
                            html+="</div></div>";
                        }
                   }
                });
                $('#attr_list').html(html);
            });
        });

        function addrow(obj){
            var div = $(obj).parent().parent();
            if($(obj).html() =="[ + ]"){
                var newdiv = div.clone();
                console.log(newdiv);
                newdiv.find('a').html('[ - ]');
                div.after(newdiv);
            }else{
                div.remove();
            }
        }

    </script>
    <script type="text/javascript">

        //实例化编辑器
        //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
        UE.getEditor('content',{initialFrameWidth:1080,initialFrameHeight:400,});
        
    </script>
    

</body></html>